package com.joven.shelltest.utils.customretry;

/**
 * 执行器
 *
 * @Author: wzj
 * @Date: 2024/3/26 14:52
 */
public class RetryExecutor {

    public static Object execute(int retryCount, ReBack callback, int num) {
        for (int curRetryCount = 0; curRetryCount < retryCount; curRetryCount++) {
            RetryResult retryResult = callback.doProcess(num);
            if (retryResult.getIsRetry()) {
                continue;
            }
            return retryResult.getObj();
        }
        return null;
    }
}
